/**
 * Copyright (C) 2025 pony working team
 * SPDX-License-Identifier: MulanPSL-2.0
 */

#include <stdio.h>

#include <x_config.h>
#include <hal_part.h>
#include <iaper.h>

#define APP_ROM_START (CONFIG_ROM_START + CONFIG_ROM_SIZE)
#define APP_ROM_SIZE  (0x000E0000)

enum PDEV_ID {
    PDEV_ID_INNER_FLASH,
    PDEV_ID_SPI_FLASH,
};

static hal_logic_part_t test_part[] = {
    // {IAP_LPAR_ID_LOADER, PDEV_ID_INNER_FLASH, "loader", CONFIG_ROM_START, CONFIG_ROM_SIZE},
    {IAP_LPAR_ID_APP, PDEV_ID_INNER_FLASH, "app", APP_ROM_START, APP_ROM_SIZE},
};

static hal_physic_dev_t test_dev[] = {
    {PDEV_ID_INNER_FLASH, "flash", NULL},
};

int main(void)
{
    printf("hello pony bootloader :-)\n");

    if (hal_part_register(test_part, ARRAY_SIZE(test_part), test_dev, ARRAY_SIZE(test_dev)) != 0) {
        printf("hal_part_register failed\n");
        return -1;
    }

    return 0;
}
